package app;

import java.util.Random;
import java.util.TimerTask;

import javax.swing.JComponent;

public class BaumTimer extends TimerTask{

	PhytbaumData pd;
	JComponent c;
	
	public BaumTimer(PhytbaumData pd, JComponent c){
		this.pd = pd;
		this.c = c;
	}
	
	public void run() {
		
		Random r = new Random();
		
		double x = pd.getSpitzX() + (r.nextInt(2)-r.nextInt(2));
		double y = pd.getSpitzY() + (r.nextInt(2)-r.nextInt(2));
		
		
		pd.changeSpitze(x, y);
		c.repaint();
		
	}

}
